﻿<UserControl x:Class="FR.SAFTAnalyserLite.Views.SaftView" 
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
             MinHeight="300" MinWidth="500">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="50*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="50*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto" />
        </Grid.ColumnDefinitions>

        <Border x:Name="GridSaftFile" Grid.Row="0" Grid.ColumnSpan="2" Margin="3" Background="#007ACC">
            <TextBlock Text="{Binding SaftFileName}" ToolTip="Por favor, coloque aqui o ficheiro SAF-T PT." 
                       AllowDrop="True" Drop="SaftFile_Drop" FontSize="20" Padding="5" TextWrapping="Wrap"/>
        </Border>
        <Button Command="{Binding OpenSaftFileCommand}" Grid.Column="1" Grid.Row="1"  Margin="5" Padding="3" Height="35" Width="35" Content="..." HorizontalAlignment="Right"/>
        <!--<Button Content="Validar estrutura" Margin="5" Padding="5" Height="35" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right"
                Command="{Binding DoValidateSchemaCommand}" />-->
        <toolkit:SplitButton Content="Validar estrutura" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" Margin="0,5,5,5" Padding="3"
                             Command="{Binding DoValidateSchemaCommand}" ToolTip="Usar a versão do ficheiro SAF-T para validação">
            <toolkit:SplitButton.DropDownContent>
                <ListBox>
                    <ListBoxItem Content="Versão 1.03_01" ToolTip="Usar a versão 1.03_01 para validação">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateSchemaV3Command}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Versão 1.02_01" ToolTip="Usar a versão 1.02_01 para validação">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateSchemaV2Command}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Versão 1.01_01" ToolTip="Usar a versão 1.03_01 para validação">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateSchemaV1Command}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                </ListBox>
            </toolkit:SplitButton.DropDownContent>
        </toolkit:SplitButton>
        
        <Border x:Name="PublicKeyFile" Grid.Row="2" Grid.ColumnSpan="2" Margin="3" Background="#007ACC">
            <TextBlock Text="{Binding PublicKeyFileName}" ToolTip="Por favor, coloque aqui o ficheiro com a chave pública."
                       AllowDrop="True" Drop="PublicKeyFile_Drop" FontSize="20" Padding="5" TextWrapping="Wrap"/>
        </Border>
        <Button Command="{Binding OpenPublicKeyFileCommand}" Grid.Column="1" Grid.Row="3" Margin="5" Padding="3" Height="35" Width="35" Content="..." HorizontalAlignment="Right"/>
        <!--<Button Command="{Binding DoValidateHashCommand}" Content="Validar Hash" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right"  Margin="0,5,5,5" Padding="3" Height="35" Width="87"/>-->
        <toolkit:SplitButton Content="Validar Hash" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" Margin="0,5,5,5" Padding="3">
            <toolkit:SplitButton.DropDownContent>
                <ListBox>
                    <ListBoxItem Content="Documentos comerciais" ToolTip="Validar as assinaturas dos documentos comerciais">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateHashCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Documentos movimentação mercadorias" ToolTip="Validar as assinaturas dos documentos de movimentação de mercadorias">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateHashMGCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Documentos conferência" ToolTip="Validar as assinaturas dos documentos de conferência">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding DoValidateHashWDCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                </ListBox>
            </toolkit:SplitButton.DropDownContent>
        </toolkit:SplitButton>

        <Border x:Name="PrivateKeyFile" Grid.Row="4" Grid.ColumnSpan="2" Margin="3" Background="#007ACC">
            <TextBlock Text="{Binding PrivateKeyFileName}" ToolTip="Por favor, coloque aqui o ficheiro com a chave privada."
                       AllowDrop="True" Drop="PrivateKeyFile_Drop" FontSize="20" Padding="5" TextWrapping="Wrap"/>
        </Border>
        <Button Command="{Binding OpenPrivateKeyFileCommand}" Grid.Column="1" Grid.Row="5"  Margin="5" Padding="3" Height="35" Width="35" Content="..." HorizontalAlignment="Right"/>
        <!--<Button Command="{Binding GenerateHashCommand}" Grid.Column="0" Grid.Row="5" Margin="0,5,5,5" Padding="3" Height="35" Content="Criar Hash" HorizontalAlignment="Right" Width="87"/>-->
        <toolkit:SplitButton Content="Criar Hash" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Right" Margin="0,5,5,5" Padding="3">
            <toolkit:SplitButton.DropDownContent>
                <ListBox>
                    <ListBoxItem Content="Documentos comerciais" ToolTip="Criar as assinaturas nos documentos comerciais">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding GenerateHashCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Documentos movimentação mercadorias" ToolTip="Criar as assinaturas nos documentos de movimentação de mercadorias">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding GenerateHashMGCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                    <ListBoxItem Content="Documentos conferência" ToolTip="Criar as assinaturas nos documentos de conferência">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseUp">
                                <cinch:EventToCommandTrigger Command="{Binding GenerateHashWDCommand}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </ListBoxItem>
                </ListBox>
            </toolkit:SplitButton.DropDownContent>
        </toolkit:SplitButton>

    </Grid>
</UserControl>
